<template>
  <div class="bus-one-view">
    <p>子组件 - busOne</p>
    <div class="input">
      <input
        type="text"
        class="input-view"
        v-model="sendText"
        placeholder="请输入内容"
      />
      <div class="btn" @click="getBusToo">传递信息 -> busToo</div>
    </div>
  </div>
</template>
<script>
import EventBus from "../bus.js";
export default {
  data() {
    return {
      sendText: "",
    };
  },
  methods: {
    getBusToo() {
      EventBus.$emit("getTarget", this.sendText);
    },
  },
};
</script>
<style lang="scss" scoped>
.bus-one-view {
  margin: 20px 10px;
  padding: 10px;
  background-color: #fff;
  border-radius: 8px;
  .input-view {
    display: block;
    border: none;
    border-bottom: 1px solid #ccc;
  }
  .btn {
    display: inline-block;
    margin: 10px 0 10px;
    padding: 5px 20px;
    border-radius: 8px;
    background-color: #67c23a;
    color: #fff;
    font-size: 12px;
  }
}
</style>